#ifndef QRESETWIDGET_H
#define QRESETWIDGET_H

#include <QWidget>
#include <QToolButton>
#include <QVariant>

namespace SHAREDLIB
{
    class QAbstractProperty;
}

namespace CORELIB
{
    class QPropertyBaseEditor : public QWidget
    {
        Q_OBJECT
        Q_PROPERTY(QString m_text READ text WRITE setText USER true)
    public:
        explicit QPropertyBaseEditor(SHAREDLIB::QAbstractProperty *pro,QWidget *parent = 0);

        void    setEditorWidget(QWidget* wid);

        void    enabledButton(bool enable);

        QString text();
        void    setText(const QString text);

        void    setReset(bool b);

        QVariant get_old_value();
        SHAREDLIB::QAbstractProperty *get_property();
    protected:
        void    paintEvent(QPaintEvent *);
        bool    eventFilter(QObject *, QEvent *);
    signals:

    public slots:
        void    propertyModified(const QString & key);
        void    reset();
    protected:
        QString                         m_text;
        QToolButton                     *m_resetButton;
        SHAREDLIB::QAbstractProperty    *m_property;
        QVariant                        m_old_value;
        QWidget*                        m_widget;
    };

}

#endif // QRESETWIDGET_H
